import request from "@/request";

export async function uploadFileUsingPost(file , folderName) {
    console.log('上传的文件对象:', file); // 添加调试信息
    if (!file) {
        throw new Error('未选择要上传的文件');
    }
    const formData = new FormData();
    formData.append('file', file);
    formData.append('folderName', folderName);

    return request({
        method: 'POST',
        url: '/api/file/upload',
        requestType: 'form',
        data: formData,
    });
}